-
Notifications
You must be signed in to change notification settings - Fork 8k
Reorganize ext/uri tests - withers #19970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: PHP-8.5
Are you sure you want to change the base?
Conversation
ext/uri/tests/whatwg/modification/host_error_forbidden_host_codepoint_opaque2.phpt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ^ character is in the percent-encode set of the path (https://url.spec.whatwg.org/#path-percent-encode-set), but somehow it's not percent-encoded.
00e380e
to
dd5e549
Compare
dd5e549
to
059b1a1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through all RFC 3986 tests. Looking pretty good overall, some nits. I also think it would be helpful to print the entire resulting URL in addition to printing the output of the getters, this makes it easier to double-check how exactly the resulting URL will look, particularly with regard to the difference between null
and ""
(e.g. whether there is a ?
for the query or not).
ext/uri/tests/rfc3986/modification/fragment_success_encoded.phpt
Outdated
Show resolved
Hide resolved
<?php | ||
|
||
$uri1 = Uri\Rfc3986\Uri::parse("https://example.com"); | ||
$uri2 = $uri1->withFragment("foo%3Dbar"); // foo=bar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also have a normalizable percent-encoded character similarly to ext/uri/tests/rfc3986/modification/host_success_encoded.phpt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be unresolved still.
ext/uri/tests/rfc3986/modification/userinfo_success_existing.phpt
Outdated
Show resolved
Hide resolved
Yes, I was also thinking about something similar (at least in some edge cases), but I didn't want to make the output too "crowded". My other concern is that most states can be tested via regular parsing 🤔 (we don't necessary have to use withers for them) |
@TimWolla What do you think about verifying URI recomposition separately? Or do you think we should always test the recomposed URI after URI modification? |
Always, because this also helps the human reader understand the test better. |
If the tests follow a common structure / order, that's easy to check and scan. You could also insert an additional newline between the various output “sections”. |
Unless I'm really needed here I'm removing my review request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taken another look at the RFC 3986 tests now. Generally LGTM. Will still need to look at the WHATWG tests.
<?php | ||
|
||
$uri1 = Uri\Rfc3986\Uri::parse("https://example.com"); | ||
$uri2 = $uri1->withFragment("foo%3Dbar"); // foo=bar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be unresolved still.
ext/uri/tests/rfc3986/modification/fragment_success_encoded.phpt
Outdated
Show resolved
Hide resolved
ext/uri/tests/rfc3986/modification/query_success_context_sensitive_reserved.phpt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a test with ->withFragment("#")
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have this test also for a special scheme for symmetry between the opaque and special tests?
@@ -0,0 +1,19 @@ | |||
--TEST-- | |||
Test Uri\WhatWg\Url component modification - password - changing an existing one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the description and filename doesn't match what the test does. It's a duplicate of ext/uri/tests/whatwg/modification/password_success_new.phpt.
@@ -0,0 +1,19 @@ | |||
--TEST-- | |||
Test Uri\WhatWg\Url component modification - username - unsetting existing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description does not match the test and does not match the filename.
@@ -0,0 +1,19 @@ | |||
--TEST-- | |||
Test Uri\WhatWg\Url component modification - username - unsetting non-existent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description does not match the test and does not match the filename.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be removed, this is just testing the signature (similarly to the one in Rfc3986 that was already removed).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in filename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly: Please add a test with "?"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate of ext/uri/tests/whatwg/modification/username_success_new.phpt
. Test doesn't match the description / filename.
--FILE-- | ||
<?php | ||
|
||
$url1 = Uri\WhatWg\Url::parse("https://example.com"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$url1 = Uri\WhatWg\Url::parse("https://example.com"); | |
$url1 = Uri\WhatWg\Url::parse("https://:password@example.com"); |
Should we also test this?
No description provided.